/*
 * @Date: 2022-04-16 12:34:26
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-04-20 15:01:16
 * @FilePath: \weibovue\src\api\topic.ts
 * @Description: something
 */
import { request } from "../utils/request";
//获取评论列表
export const reqTopicList = (
  currentPage: number = 1,
  pageSize: number = 5,
  id?: number,
) => {
  if (id) {
    id = id;
  }
  return request({
    url: `/topics/${id}`,
    method: "get",
    params: {
      currentPage,
      pageSize,
    },
  });
};
//创建评论
export const reqCreateTopic = (id: number, data: { content: string }) => {
  return request({
    url: `/topics/${id}`,
    method: "post",
    data,
  });
};
//创建回复
export const reqCreateReply = (
  replyUserId: number,
  data: {
    content: string;
    type: string;
  },
  parantId: number = -1,
  commentId: number = -1,
  blogId: number,
) => {
  return request({
    url: `/topics/reply/${replyUserId}/${parantId}/${commentId}/${blogId}`,
    method: "post",
    data,
  });
};
//删除评论
export const deleteComment = (commentId: number) => {
  return request({
    url: `/topics/${commentId}`,
    method: "delete",
  });
};
